﻿package mortal.game.view.tianDiRank.data
{
    import Message.Public.*;

    public class TianDiRankCache extends Object
    {
        public var isDiRankFlag:Boolean = true;
        public var realDiRankFlag:Boolean = true;
        public var mainInfoArr:Array;
        public var mainIdArr:Array;
        public var detail:SPlacardDetailInfo;
        public var replace:SPlacardDetailInfo;
        public var resultInfo:SPlacardChallengeResult;
        public var copyInfo:SPlacardChallengeInfo;
        public var selfCdTime:int = 0;
        public var tianSelfCdTime:int = 0;
        public var jobBusy:SPlacardChallengeInfo;
        public var tianOpenFlag:int = 0;
        public var cdCkIndex:int;
        public var openIndex:Array;

        public function TianDiRankCache()
        {
            this.mainInfoArr = [];
            this.mainIdArr = [];
            this.openIndex = [];
            return;
        }// end function

        public function setMainInfo(param1:uint, param2:SPlacardMainInfo) : void
        {
            var _loc_3:String = null;
            var _loc_4:int = 0;
            this.mainInfoArr[param1] = param2;
            this.mainIdArr[param1] = [];
            for (_loc_3 in param2.playerInfo)
            {
                
                _loc_4 = parseInt(_loc_3);
                this.mainIdArr[param1].push(_loc_4);
            }
            this.mainIdArr[param1].sort(this.sortIds);
            return;
        }// end function

        private function sortIds(param1:int, param2:int) : int
        {
            var _loc_3:* = TianDiRankConfig.instance.copyCfg[param1];
            var _loc_4:* = TianDiRankConfig.instance.copyCfg[param2];
            if (_loc_3.jobLevel < _loc_4.jobLevel)
            {
                return -1;
            }
            if (_loc_3.jobLevel > _loc_4.jobLevel)
            {
                return 1;
            }
            if (_loc_3.jobPosition < _loc_4.jobPosition)
            {
                return -1;
            }
            if (_loc_3.jobPosition > _loc_4.jobPosition)
            {
                return 1;
            }
            return 0;
        }// end function

        public function getPlayerInfo(param1:uint, param2:int) : SDisplayPlayer
        {
            var _loc_3:* = this.mainInfoArr[param1];
            if (_loc_3)
            {
                return _loc_3.playerInfo[param2] as SDisplayPlayer;
            }
            return null;
        }// end function

        public function setCopyInfo(param1:SPlacardChallengeInfo) : void
        {
            this.copyInfo = param1;
            return;
        }// end function

        public function setDetailInfo(param1:SPlacardDetailInfo) : void
        {
            this.detail = param1;
            return;
        }// end function

        public function setResultInfo(param1:SPlacardChallengeResult) : void
        {
            this.resultInfo = param1;
            return;
        }// end function

        public function setOpenIndex(param1:String = "") : void
        {
            this.openIndex = param1.split("_");
            return;
        }// end function

    }
}
